<?php
require_once 'classquantritin.php';
$qt = new quantritin();
date_default_timezone_set('Asia/Ho_Chi_Minh');
if (isset($_GET['act'])) {
    if ($_GET['act'] == 'addclose') {
        $qt->working_add();
        header('location:index.php');
    }
    if ($_GET['act'] == 'add') {
        $qt->working_add();
        $id = mysql_insert_id();
        header("location:index.php?p=working_edit&id=$id");
    }
}
?>
<style>
    input[type="checkbox"]{
        margin-top: 0;
        line-height: normal;
    }
    .checkbox {
        margin: 30px 0 0 0;
    }
</style>
<script>
    function onSubmitForm(formName, url)
    {
        var theForm = document.getElementById(formName);
        theForm.action = url;
        theForm.submit();
        return true;
    }
</script>
<div class="well heading">
    <div class="pull-left">
        <h1><span class="glyphicon glyphicon-list-alt"></span> Lịch công tác : Thêm</h1>
    </div>
    <div class="pull-right"> 
        <a onclick="onSubmitForm('admin_form', 'index.php?p=working_add&act=add')" class="btn btn-stan-sm" act="save"> <span class="glyphicon glyphicon-floppy-saved"></span><span class="text"> Lưu</span></a>
        <a onclick="onSubmitForm('admin_form', 'index.php?p=working_add&act=addclose')" class="btn btn-stan-sm" act="saveclose"> <span class="glyphicon glyphicon-floppy-saved"></span><span class="text"> Lưu & Đóng</span></a>
        <a href="index.php" class="btn btn-stan-sm"> <span class="glyphicon glyphicon-remove-circle"></span> <span class="text">Huỷ</span></a></div>
</div>
<form enctype="multipart/form-data" action="index.php?p=catadd" method="post" name="admin_form" id="admin_form">
    <div class="form-group">
        <label>Nội dung</label>
        <textarea class="form-control" rows="10" cols="40" name="content" id="content"></textarea>
        <script type="text/javascript">


    CKEDITOR.replace('content', {
        filebrowserImageBrowseUrl: 'ckfinder/ckfinder.html?Type=Images',
        filebrowserFlashBrowseUrl: 'ckfinder/ckfinder.html?Type=Flash',
        filebrowserImageUploadUrl: 'ckfinder/core/connector/php/connector.php?command=QuickUpload&type=Images',
        filebrowserFlashUploadUrl: 'ckfinder/core/connector/php/connector.php?command=QuickUpload&type=Flash'
    });

        </script> 
    </div>
    <div class="form-group">
        <label>Địa điểm</label>
        <input type="text" class="form-control" value="" name="address" />
    </div>
    <div class="form-group">
        <div class="row">

            <div class="col-md-6">    
                <label>Giờ đi</label>
                <input type="text" class="form-control" value="<?php echo date('d/m/Y H:i') ?>" name="checkout" id="checkout" />
            </div>
            <div class="col-md-6">    
                <label>Giờ về</label>
                <input type="text" class="form-control" value="" name="checkin" id="checkin" />
            </div>

        </div>
    </div>
    <div class="form-group">
        <label>Nhân sự</label>
        <textarea class="form-control" rows="10" cols="40" name="emp" id="emp"></textarea>
        <script>
            CKEDITOR.replace('emp', {
                filebrowserImageBrowseUrl: 'ckfinder/ckfinder.html?Type=Images',
                filebrowserFlashBrowseUrl: 'ckfinder/ckfinder.html?Type=Flash',
                filebrowserImageUploadUrl: 'ckfinder/core/connector/php/connector.php?command=QuickUpload&type=Images',
                filebrowserFlashUploadUrl: 'ckfinder/core/connector/php/connector.php?command=QuickUpload&type=Flash',
                enterMode : CKEDITOR.ENTER_BR
            });
        </script>
    </div>

    <div class="row">
        <div class="col-lg-3 col-md-4 col-sm-4">
            <div class="form-group">
                <label>Status</label>
                <div>
                    <div data-toggle="buttons" class="btn-group">
                        <label class="btn btn-primary">
                            <input type="radio"  value="0" name="status" >
                            Ẩn</label>
                        <label class="btn btn-primary active">
                            <input type="radio" value="1" name="status" checked="checked">
                            Hiện</label>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <input name="act" type="hidden" id="act" value="add" />

</form>